<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="icon" href="../../logo.svg" />
    <title>条件渲染</title>
  </head>
  <body>
    <div id="root">
      <h2>当前n的值：{{n}}</h2>
      <button @click="n++">n+1</button>

      <div v-show="n === 1">Angular</div>
      <div v-show="n === 2">React</div>
      <div v-show="n === 3">Vue</div>

      <hr />
      <div v-if="n === 1">Angular</div>
      <div v-if="n === 2">React</div>
      <div v-if="n === 3">Vue</div>

      <hr />
      <div v-if="n === 1">Angular</div>
      <div v-else-if="n === 2">React</div>
      <div v-else-if="n === 3">Vue</div>
      <div v-else>Other</div>

      <hr />
      <template v-if="n===1">
        <div>你好</div>
        <div>世界</div>
        <div>密云不雨</div>
      </template>
    </div>

    <script src="../../vue.js"></script>
    <script>
      Vue.config.productionTip = false; // 阻止 vue 在启动时生成生产提示。

      new Vue({
        el: "#root",
        data: {
          n: 0,
        },
      });
    </script>
  </body>
</html>
